import axios from './axios.js';

const gethone = () => axios.get("homeNav.json");
const gethonenr = (page = 1) => axios.get(`video/item`, { params: { page } });
const gethonenr2 = (page = 2) => axios.get(`video/item`, { params: { page } });
const getzfenglei = () => axios.get("category.json");

const getmall = () => axios.get("shopNav.json");
const getmall2 = (page = 1) => axios.get(`goods/personalized`, { params: { page } });
const getzifenglei = (pid) => axios.get(`category/getSub`, { params: { pid } });
const getHomeAllLabel = () => axios.get("/live/tabList?tabId=60");
const CarItem = (itemId) => axios.get(`goods/detail?itemId=${itemId}`);
const shangpxq = (itemId) => axios.get(`goods/detail`, { params: { itemId } });

const BASE_URL = 'https://apis.netstart.cn/mogujie';
const fetchLiveTabList = async (tabId, pageIndex = 1) => {
  try {
    const response = await axios.get(`${BASE_URL}/live/tabList`, {
      params: {
        tabId,
        pageIndex,
      }
    });
    return response.data.data;
  } catch (error) {
    console.error('Error fetching live tab list:', error);
    throw error;
  }
};

export {
  getmall2,getmall,gethone, gethonenr, getzfenglei, getzifenglei, gethonenr2, CarItem, getHomeAllLabel, shangpxq, fetchLiveTabList
};
